package com.crud.demo1.demos.controller;

import com.crud.demo1.demos.commons.AjaxResult;
import com.crud.demo1.demos.commons.annotation.LimitRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangning
 * @since 2025/2/26 18:19
 */
@Api(tags = "首页模块")
@RestController
public class IndexController {

    @ApiImplicitParam(name = "name",value = "姓名",required = true)
    @ApiOperation(value = "向客人问好")
    @GetMapping("/sayHi")
    public ResponseEntity<String> sayHi(@RequestParam(value = "name")String name){
        return ResponseEntity.ok("Hi:"+name);
    }

    @LimitRequest()
    @ApiImplicitParam(name = "name",value = "姓名",required = true)
    @ApiOperation(value = "sayHi1",notes = "向客人问好")
    @GetMapping("/sayHi1")
    public AjaxResult sayHi1(@RequestParam(value = "name") String name){
        return AjaxResult.ok(name);
    }
}
